﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Roslyn.Compilers.Common;
using Roslyn.Services;

namespace Analysis.Rules
{
    class StaticMethodVolatileChecker : IVolatileChecker
    {
        private IRoslynHelper helper;

        public StaticMethodVolatileChecker(IRoslynHelper helper)
        {
            this.helper = helper;
        }
        public bool IsVolatile(CommonSyntaxNode node, IDocument doc)
        {
            var ts = helper.GetTypeAndSymbol(node, doc);
            
            if (ts.Item1 == null || ts.Item2 == null)
                return false;

            var foo = ts.GetType();

             return ts.Item2.IsStatic && ts.Item2.DeclaredAccessibility != CommonAccessibility.Private; 
        }
    }
}
